home *** CD-ROM | disk | FTP | other *** search
/ NOVA - For the NeXT Workstation / NOVA - For the NeXT Workstation.iso / SourceCode / AdobeExamples / NX_Text / DrawingView.h < prev    next >
Encoding:
Text File  |  1992-12-19  |  3.7 KB  |  140 lines

  1.  
  2. /*
  3.  * (a)  (C) 1990 by Adobe Systems Incorporated. All rights reserved.
  4.  *
  5.  * (b)  If this Sample Code is distributed as part of the Display PostScript
  6.  *    System Software Development Kit from Adobe Systems Incorporated,
  7.  *    then this copy is designated as Development Software and its use is
  8.  *    subject to the terms of the License Agreement attached to such Kit.
  9.  *
  10.  * (c)  If this Sample Code is distributed independently, then the following
  11.  *    terms apply:
  12.  *
  13.  * (d)  This file may be freely copied and redistributed as long as:
  14.  *    1) Parts (a), (d), (e) and (f) continue to be included in the file,
  15.  *    2) If the file has been modified in any way, a notice of such
  16.  *      modification is conspicuously indicated.
  17.  *
  18.  * (e)  PostScript, Display PostScript, and Adobe are registered trademarks of
  19.  *    Adobe Systems Incorporated.
  20.  * 
  21.  * (f) THE INFORMATION BELOW IS FURNISHED AS IS, IS SUBJECT TO
  22.  *    CHANGE WITHOUT NOTICE, AND SHOULD NOT BE CONSTRUED
  23.  *    AS A COMMITMENT BY ADOBE SYSTEMS INCORPORATED.
  24.  *    ADOBE SYSTEMS INCORPORATED ASSUMES NO RESPONSIBILITY
  25.  *    OR LIABILITY FOR ANY ERRORS OR INACCURACIES, MAKES NO
  26.  *    WARRANTY OF ANY KIND (EXPRESS, IMPLIED OR STATUTORY)
  27.  *    WITH RESPECT TO THIS INFORMATION, AND EXPRESSLY
  28.  *    DISCLAIMS ANY AND ALL WARRANTIES OF MERCHANTABILITY, 
  29.  *    FITNESS FOR PARTICULAR PURPOSES AND NONINFRINGEMENT
  30.  *    OF THIRD PARTY RIGHTS.
  31.  */
  32.  
  33. /*
  34.  *    DrawingView.h
  35.  *
  36.  *    This view represents the page that the image is drawn onto. It is
  37.  *    the doc view of the scroll view and can be scrolled.
  38.  *
  39.  *    Version:    2.0
  40.  *    Author:    Ken Fromm
  41.  *    History:
  42.  *            03-07-91        Added this comment.
  43.  */
  44.  
  45. #import "hdshowany.h"
  46. #import <appkit/View.h>
  47.  
  48. #define  FONTSIZE        12
  49. #define  ROTATION        30
  50. #define  FONTMETRICS    (NX_FONTHEADER | NX_FONTCHARDATA | NX_FONTKERNING)
  51.  
  52. #define  TRACKVAL    2.0
  53.  
  54. #define  NUM_LINES        19        /* Number of lines in text.c */
  55. #define  LINE_LENGTH        330        /* Length for calculating full justification */
  56. #define  LINE_LENGTH_TR    462        /* Length for calculating full justification with tracking */
  57. #define  MAX_XSHOW        128
  58.  
  59. #define  XSHOW        0
  60. #define  RMSHOW        1
  61. #define  VARSHOW    2
  62.  
  63. #define  KERN_TAG    0
  64. #define  WIDTH_TAG    1
  65.  
  66. typedef struct _Timing {
  67.     int        chars;
  68.     int        reshows;
  69.     int        kerns;
  70.     int        time;
  71. }  Timing;
  72.  
  73. @interface DrawingView:View
  74. {
  75.     BOOL        eraseFields,        /* If yes, erase the timing fields */
  76.                 trace,            /* If yes, turn on DPSTraceContext()  */
  77.  
  78.                 justify,            /* If yes, justify the text */
  79.                 kern,            /* If yes, kern the text */
  80.                 track,            /* If yes, track the text */
  81.                 cache,            /* If no, set the byte limit of the cache real low */
  82.                                 /* Previous fonts and size are still in the cache. */
  83.                                 /* Only new fonts and sizes will not be cached. */
  84.                 outline,            /* If yes, use the outline font dictionary */
  85.                 screen,            /* If yes, use screen widths */
  86.  
  87.                 compareKern,        /* If yes, show both kerning and no kerning */
  88.                 compareWidths;    /* If yes, show both printer and screen width */
  89.  
  90.     int            showtype,        /* The type of font showing technique to use */
  91.  
  92.                 rotation,            /* The rotation of this view. */
  93.  
  94.                 size,                /* Font cache parameters */
  95.                 lower,
  96.                 upper;
  97.  
  98.     float            fontsize;            /* The current font size */
  99.  
  100.     NXCoord        *charspace;
  101.  
  102.     ShowStruct    s;
  103.                 /* The structure for holding the information for */
  104.                                 /* each line of text when displaying. */
  105.  
  106.     Timing        timing_info;        /* TIming information */
  107. }
  108.  
  109. +newFrame:(NXRect *) frm;
  110. - free;
  111.  
  112. - (int) rotation;
  113.  
  114. - justify:sender;
  115. - kern:sender;
  116. - track:sender;
  117. - cache:sender;
  118. - outline:sender;
  119.  
  120. - show:sender;
  121.  
  122. - compareKerns:sender;
  123. - compareWidths:sender;
  124.  
  125. - rotate:sender;
  126.  
  127. - trace:sender;
  128.  
  129. - eraseFields:sender;
  130. - resetFields:sender;
  131. - displayFields:sender;
  132.  
  133. - reshow:sender;
  134.  
  135. - mouseDown:(NXEvent *)event;
  136.  
  137. - showText:(const NXRect *)r;
  138. - drawSelf:(const NXRect *)r :(int) count;
  139.  
  140. @end
  141.